<template>
	<view class="consult">
		<news-list @goDetail="goDetail" :newsList="newsList"></news-list>
	</view>
</template>

<script>
	import newsList from '../../components/news-list/index.vue'
	export default {
		data(){
			return {
				newsList:[],
				color:'pink'
			}
			
		},
		components:{
			newsList
		},
		onLoad() {
			this.getNewsList()
		},
		methods:{
			async getNewsList(){
				const res= await this.$myRequest({
					url:'/api/getnewslist'
				})
				this.newsList=res.data.message.map((item)=>{
					item.add_time=item.add_time.substr(0,10)
					return item
				})
			 },
			goDetail(id){
				uni.navigateTo({
					url:`../detail/detail?id=${id}`
				})
			}
		}
		
	}
</script>

<style lang="scss">
	
</style>
